// Copyright (C) joyinter
// All rights reserved.
// 
// Author : Jiang Li
// Date   : 2005-1-11

#ifndef __TRANS_UDP_H_SERVER_SVR_MAIN__
#define __TRANS_UDP_H_SERVER_SVR_MAIN__

#pragma once

#include <common/svr_base/net_socket.h>

namespace JoyServer
{

class CJoyMainRoom;
//added by deng
class CJoyMainUser;

class CJoyTransUDP : public CJoySocket
{
public:
    CJoyMainRoom*   m_room;
    virtual void OnError(int err);
    virtual void OnRecv(CJoyTransmitData* recvData, const sockaddr_in& fromAddr);
	void BroadCastAddr(const JoyMessage::MC_MainLogin * msg,const sockaddr_in addr,const JoyServer::CJoyMainUser * pUser);//added by deng 

public:
    CJoyTransUDP();
    virtual ~CJoyTransUDP();

    bool Create(const sockaddr_in& addr);
    bool Create(const char* ip, int port);
    bool Create(CJoyMainRoom* pRoom);
    void Destroy();
};

} // namespace JoyServer

#endif  // __TRANS_UDP_H_SERVER_SVR_MAIN__